HAL ADC I/O operation function migration

This section provides information about the HAL ADC I/O operation function migration.

HAL ADC start

HAL1

HAL2

The HAL_ADC_Start function was responsible for both enabling the ADC and starting the conversion of the regular group.

Functionality:

  • Enable the ADC peripheral.

  • Start the conversion of the regular group.

The functionality has been divided into two separate functions: HAL_ADC_Start and HAL_ADC_REG_StartConv.

Functionality Split:

  1. `HAL_ADC_Start`: activate the ADC instance.

  2. `HAL_ADC_REG_StartConv`: start the conversion on the regular group.

HAL_ADC_Start
HAL_ADC_Start
HAL_ADC_REG_StartConv

Rationale: activation of the ADC is time consuming; the idea is to control the conversion start and stop without the need to fully deactivate and activate the ADC.

Related use case: Use case: conversion by polling


HAL ADC stop

HAL1

HAL2

The HAL_ADC_Stop function was responsible for stopping the ADC conversion of the regular group (and injected channels in auto-injection mode) and disabling the ADC peripheral.

Functionality:

  • Stop ADC conversion of the regular group (and injected channels in case of auto-injection mode).

  • Disable the ADC peripheral.

This functionality has been divided into two separate functions: HAL_ADC_Stop and HAL_ADC_REG_StopConv.

Functionality Split:

  1. `HAL_ADC_REG_StopConv`: stop the conversion on the regular group.

  2. `HAL_ADC_Stop`: deactivate the ADC instance.

HAL_ADC_Stop
HAL_ADC_REG_StopConv
HAL_ADC_Stop

Related use case: Use case: conversion by polling


HAL ADC start interrupt mode

HAL1

HAL2

The HAL_ADC_Start_IT function was responsible for both enabling the ADC and starting the conversion of the regular group.

Functionality:

  • Enable the ADC peripheral.

  • Start the conversion of the regular group.

The functionality has been divided into two separate functions: HAL_ADC_Start and HAL_ADC_REG_StartConv_IT.

Functionality Split:

  1. `HAL_ADC_Start`: activate the ADC instance.

  2. `HAL_ADC_REG_StartConv_IT`: start the conversion on the regular group in interruption mode.

HAL_ADC_Start_IT
HAL_ADC_Start
HAL_ADC_REG_StartConv_IT

Related use case: Use case: conversion by interruption


HAL ADC stop interrupt mode

HAL1

HAL2

The HAL_ADC_Stop_IT function was responsible for stopping the ADC conversion of the regular group (and injected channels in auto-injection mode) and disabling the ADC peripheral.

Functionality:

  • Stop ADC conversion of the regular group (and injected channels in case of auto-injection mode).

  • Disable the ADC peripheral.

  • Manage ADC states and error codes.

This functionality has been divided into two separate functions: HAL_ADC_REG_StopConv_IT and HAL_ADC_Stop.

Functionality Split:

  1. `HAL_ADC_REG_StopConv_IT`: stop the conversion on the regular group.

  2. `HAL_ADC_Stop`: deactivate the ADC instance.

HAL_ADC_Stop_IT
HAL_ADC_REG_StopConv_IT
HAL_ADC_Stop

Related use case: Use case: conversion by interruption


HAL ADC start DMA

HAL1

HAL2

The HAL_ADC_Start_DMA function was responsible for both enabling the ADC and starting the conversion of the regular group.

Functionality:

  • Enable the ADC peripheral.

  • Start the conversion of the regular group.

The functionality has been divided into two separate functions: HAL_ADC_Start and HAL_ADC_REG_StartConv_DMA.

Functionality Split:

  1. `HAL_ADC_Start`: activate the ADC instance.

  2. `HAL_ADC_REG_StartConv_DMA`: start the conversion on the regular group.

HAL_ADC_Start_DMA
HAL_ADC_Start
HAL_ADC_REG_StartConv_DMA

Related use case: Use case: conversion in DMA mode


HAL ADC stop DMA

HAL1

HAL2

The HAL_ADC_Stop_DMA function was responsible for stopping the ADC conversion of the regular group (and injected channels in auto-injection mode) and disabling the ADC peripheral.

Functionality:

  • Stop ADC conversion of the regular group (and injected channels in auto-injection mode).

  • Disable the ADC peripheral.

This functionality has been divided into two separate functions: HAL_ADC_REG_StopConv_DMA and HAL_ADC_Stop.

Functionality Split:

  1. `HAL_ADC_REG_StopConv_DMA`: stop the conversion on the regular group in DMA mode.

  2. `HAL_ADC_Stop`: deactivate the ADC instance.

HAL_ADC_Stop_DMA
HAL_ADC_REG_StopConv_DMA
HAL_ADC_Stop

Related use case: Use case: conversion in DMA mode


HAL ADCEx injected start

HAL1

HAL2

The HAL_ADCEx_InjectedStart function was responsible for both enabling the ADC and starting the conversion of the injected group.

Functionality:

  • Enable the ADC peripheral.

  • Start the conversion of the injected group.

The functionality has been divided into two separate functions: HAL_ADC_Start and HAL_ADC_INJ_StartConv.

Functionality Split:

  1. `HAL_ADC_Start`: activate the ADC instance.

  2. `HAL_ADC_INJ_StartConv`: start the conversion on the injected group.

HAL_ADCEx_InjectedStart
HAL_ADC_Start
HAL_ADC_INJ_StartConv

Related use case: Use case: conversion by polling


HAL ADCEx injected stop

HAL1

HAL2

The HAL_ADCEx_InjectedStop function was responsible for stopping the ADC conversion of the injected group and disabling the ADC peripheral.

Functionality:

  • Stop ADC conversion of the injected group.

  • Disable the ADC peripheral.

This functionality has been divided into two separate functions: HAL_ADC_INJ_StopConv and HAL_ADC_Stop.

Functionality Split:

  1. `HAL_ADC_INJ_StopConv`: stop the conversion on the injected group.

  2. `HAL_ADC_Stop`: deactivate the ADC instance.

HAL_ADCEx_InjectedStop
HAL_ADC_INJ_StopConv
HAL_ADC_Stop

Related use case: Use case: conversion by polling


HAL ADCEx injected start interrupt mode

HAL1

HAL2

The HAL_ADCEx_InjectedStart_IT function was responsible for both enabling the ADC and starting the conversion of the injected group.

Functionality:

  • Enable the ADC peripheral.

  • Start the conversion of the injected group.

The functionality has been divided into two separate functions: HAL_ADC_Start and HAL_ADC_INJ_StartConv_IT.

Functionality Split:

  1. `HAL_ADC_Start`: activate the ADC instance.

  2. `HAL_ADC_INJ_StartConv_IT`: start the conversion on the injected group.

HAL_ADCEx_InjectedStart_IT
HAL_ADC_Start
HAL_ADC_INJ_StartConv_IT

Related use case: Use case: conversion by polling


HAL ADCEx injected stop interrupt mode

HAL1

HAL2

The HAL_ADCEx_InjectedStop_IT function was responsible for stopping the ADC conversion of the injected group and disabling the ADC peripheral.

Functionality:

  • Stop ADC conversion of the injected group (and injected channels in auto-injection mode).

  • Disable the ADC peripheral.

  • Manage ADC states and error codes.

This functionality has been divided into two separate functions: HAL_ADC_INJ_StopConv_IT and HAL_ADC_Stop.

Functionality Split:

  1. `HAL_ADC_INJ_StopConv_IT`: stop the conversion on the injected group.

  2. `HAL_ADC_Stop`: deactivate the ADC instance.

HAL_ADCEx_InjectedStop_IT
HAL_ADC_INJ_StopConv_IT
HAL_ADC_Stop

Related use case: Use case: conversion by interruption


HAL ADCEx regular stop

HAL1

HAL2

The HAL_ADCEx_RegularStop function was responsible for stopping the ADC conversion of the regular group and disabling the ADC peripheral.

Functionality:

  • Stop ADC conversion of the Regular group.

  • Disable the ADC peripheral.

This functionality has been divided into two separate functions: HAL_ADC_REG_StopConv and HAL_ADC_Stop.

Functionality Split:

  1. `HAL_ADC_REG_StopConv`: stop the conversion on the regular group.

  2. `HAL_ADC_Stop`: deactivate the ADC instance.

HAL_ADCEx_RegularStop
HAL_ADC_REG_StopConv
HAL_ADC_Stop

Related use case: Use case: conversion by polling


HAL ADCEx regular stop interrupt mode

HAL1

HAL2

The HAL_ADCEx_RegularStop_IT function was responsible for stopping the ADC conversion of the regular group and disabling the ADC peripheral.

Functionality:

  • Stop ADC conversion of the regular group (and injected channels in auto-injection mode).

  • Disable the ADC peripheral.

This functionality has been divided into two separate functions: HAL_ADC_REG_StopConv_IT and HAL_ADC_Stop.

Functionality Split:

  1. `HAL_ADC_REG_StopConv_IT`: stop the conversion on the regular group.

  2. `HAL_ADC_Stop`: deactivate the ADC instance.

HAL_ADCEx_RegularStop_IT
HAL_ADC_REG_StopConv_IT
HAL_ADC_Stop

Related use case: Use case: conversion by interruption


HAL ADCEx regular stop DMA

HAL1

HAL2

The HAL_ADCEx_RegularStop_DMA function was responsible for stopping the ADC conversion of the regular group (and injected channels in auto-injection mode) and disabling the ADC peripheral.

Functionality:

  • Stop ADC conversion of the regular group (and injected channels in auto-injection mode).

  • Disable the ADC peripheral.

This functionality has been divided into two separate functions: HAL_ADC_REG_StopConv_DMA and HAL_ADC_Stop.

Functionality Split:

  1. `HAL_ADC_REG_StopConv_DMA`: stop the conversion on the regular group.

  2. `HAL_ADC_Stop`: deactivate the ADC instance.

HAL_ADCEx_RegularStop_DMA
HAL_ADC_REG_StopConv_DMA
HAL_ADC_Stop

Related use case: Use case: conversion in DMA mode


HAL ADCEx multimode start DMA

HAL1

HAL2

The HAL_ADCEx_MultiModeStart_DMA function was responsible for both enabling the ADC and starting the conversion of the regular group.

Functionality:

  • Enable the ADC peripheral.

  • Start MultiMode Conversion.

The functionality has been divided into two separate functions: HAL_ADC_MM_Start and HAL_ADC_MM_REG_StartConv_DMA.

Functionality Split:

  1. `HAL_ADC_MM_Start`: activate the ADC instances that are configured to operate in multimode.

  2. `HAL_ADC_MM_REG_StartConv_DMA`: start the conversion in multimode.

HAL_ADCEx_MultiModeStart_DMA
HAL_ADC_MM_Start
HAL_ADC_MM_REG_StartConv_DMA

Related use case: Use case: conversion in multimode DMA


HAL ADCEx multimode stop DMA

HAL1

HAL2

The HAL_ADCEx_MultiModeStop_DMA function was responsible for stopping the ADC conversion in multimode.

Functionality:

  • Stop potential ongoing multimode conversion, on regular and injected groups

  • Disable the ADC peripheral when conversions have been stopped.

This functionality has been divided into two separate functions: HAL_ADC_MM_REG_StopConv_DMA and HAL_ADC_MM_Stop.

Functionality Split:

  1. `HAL_ADC_MM_REG_StopConv_DMA`: stop the conversion on multimode ADC instances of the regular group.

  2. `HAL_ADC_MM_Stop`: deactivate each ADC handle in the multimode setup.

HAL_ADCEx_MultiModeStop_DMA
HAL_ADC_MM_REG_StopConv_DMA
HAL_ADC_MM_Stop

Related use case: Use case: conversion in multimode DMA


HAL ADCEx regular multimode stop DMA

HAL1

HAL2

The HAL_ADCEx_MultiModeStop_DMA function was responsible for stopping the ADC conversion in multimode.

Functionality:

  • Stop DMA-based multimode ADC conversion.

  • Disable ADC DMA transfer.

  • Disable ADC peripheral if no injected conversion is ongoing.

This functionality has been divided into two separate functions: HAL_ADC_MM_REG_StopConv_DMA and HAL_ADC_MM_Stop.

Functionality Split:

  1. `HAL_ADC_MM_REG_StopConv_DMA`:

    • Stop conversion on multimode ADC instances of the regular group with DMA data transfer.

    • Disable ADC DMA transfer.

  2. `HAL_ADC_MM_Stop`: deactivate each ADC handle in the multimode setup.

HAL_ADCEx_MultiModeStop_DMA
HAL_ADC_MM_REG_StopConv_DMA
HAL_ADC_MM_Stop

Related use case: Use case: conversion in multimode DMA


HAL ADCEx injected poll for conversion

HAL1

HAL2

Function name

HAL_ADCEx_InjectedPollForConversion

HAL_ADC_INJ_PollForConv

Parameters

  1. ADC_HandleTypeDef *hadc

  2. uint32_t Timeout

  1. hal_adc_handle_t *hadc

  2. uint32_t timeout_ms

Return Value

Returns HAL_OK , indicating successful polling for conversion completion, or HAL_TIMEOUT if a timeout occurs.

Returns HAL_OK , indicating successful polling for conversion completion, or HAL_TIMEOUT if a timeout occurs.

Related use case: Use case: conversion by polling


HAL ADCEx injected get value

HAL1

HAL2

Function name

HAL_ADCEx_InjectedGetValue

HAL_ADC_INJ_GetValue

Parameters

  1. const ADC_HandleTypeDef *hadc

  2. uint32_t InjectedRank

  1. const hal_adc_handle_t *hadc

  2. uint8_t sequencer_rank

Return Value

Returns the ADC injected group conversion data.

Returns the conversion data (signed value between -2147483648 and +2147483647).

Related use case: Use case: conversion by polling


HAL ADC poll for conversion

HAL1

HAL2

Function name

HAL_ADC_PollForConversion

HAL_ADC_REG_PollForConv

Parameters

  1. ADC_HandleTypeDef *hadc

  2. uint32_t Timeout

  1. hal_adc_handle_t *hadc

  2. uint32_t timeout_ms

Return Value

Returns HAL_OK , indicating successful polling for conversion completion, or HAL_TIMEOUT if a timeout occurs.

Returns HAL_OK , indicating successful polling for conversion completion, or HAL_TIMEOUT if a timeout occurs.

Related use case: Use case: conversion by polling


HAL ADC poll for event

HAL1

HAL2

Function name

HAL_ADC_PollForEvent

HAL_ADC_PollForEvent

Parameters

  1. ADC_HandleTypeDef *hadc

  2. uint32_t EventType

  3. uint32_t Timeout

  1. hal_adc_handle_t *hadc

  2. hal_adc_event_t event

  3. uint32_t timeout_ms

Return Value

Returns HAL_OK , indicating successful polling for conversion completion, or HAL_TIMEOUT if a timeout occurs.

Returns HAL_OK , indicating successful polling for conversion completion, or HAL_TIMEOUT if a timeout occurs.

Related use case: Use case: conversion by polling


HAL ADC get value

HAL1

HAL2

Function name

HAL_ADC_GetValue

HAL_ADC_REG_GetValue

Parameters

const ADC_HandleTypeDef *hadc

const hal_adc_handle_t *hadc

Return Value

Returns the ADC regular group conversion data.

Returns the conversion data (signed value between -2147483648 and +2147483647).

Related use case: Use case: conversion by polling


HAL ADCEx multimode get value

HAL1

HAL2

Function name

HAL_ADCEx_MultiModeGetValue

HAL_ADC_MM_REG_GetValue

Parameters

const ADC_HandleTypeDef *hadc

  1. const hal_adc_handle_t *hadc

  2. hal_adc_mm_inst_t multi_inst

Return Value

Returns the converted data values.

Returns the conversion data (unsigned value between 0x00000000 and 0xFFFFFFFF).

Related use case: Use case: conversion in multimode DMA


HAL ADC IRQ handler

HAL1

HAL2

Function name

HAL_ADC_IRQHandler

  • HAL_ADC_IRQHandler

  • HAL_ADC_IRQHandler_REG, HAL_ADC_IRQHandler_INJ, HAL_ADC_IRQHandler_AWD

Parameters

ADC_HandleTypeDef *hadc

hal_adc_handle_t *hadc

Return Value

N/A.

N/A.

Related use case: Use case: conversion by interruption


HAL ADC error callback

HAL1

HAL2

Function name

HAL_ADC_ErrorCallback

HAL_ADC_ErrorCallback

Parameters

ADC_HandleTypeDef* hadc

hal_adc_handle_t *hadc

Return Value

N/A.

N/A.

Related use case: Use case: conversion by interruption


HAL ADC level out of window callback

HAL1

HAL2

Function name

HAL_ADC_LevelOutOfWindowCallback, HAL_ADCEx_LevelOutOfWindow2Callback, HAL_ADCEx_LevelOutOfWindow3Callback

HAL_ADC_AnalogWD_OutOfWindowCallback

Parameters

ADC_HandleTypeDef *hadc

  1. hal_adc_handle_t *hadc

  2. hal_adc_awd_instance_t awd_instance

Return Value

N/A.

N/A.

Related use case: Use case: conversion by interruption


HAL ADC conversion half complete callback

The difference between HAL1 and HAL2 is a simple renaming of the function.

HAL1

HAL2

Function name

HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef *hadc)

HAL_ADC_REG_DataTransferHalfCallback(hal_adc_handle_t *hadc)

Related use case: Use case: conversion in DMA mode


HAL ADC conversion complete callback

The difference between HAL1 and HAL2 is a simple renaming of the function.

HAL1

HAL2

Function name

HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)

HAL_ADC_REG_DataTransferCpltCallback(hal_adc_handle_t *hadc)

Related use case: Use case: conversion in DMA mode


HAL ADCEx calibration start

HAL1

HAL2

Function name

HAL_ADCEx_Calibration_Start

HAL_ADC_Calibrate

Parameters

  1. ADC_HandleTypeDef *hadc

  2. uint32_t SingleDiff

hal_adc_handle_t *hadc

Return Value

Returns HAL_OK if calibration is successful, HAL_ERROR if it fails.

Returns HAL_OK if calibration is successful, HAL_ERROR if it fails.

Related use case: Use case: conversion by polling


HAL ADCEx calibration get value

HAL1

HAL2

Function name

HAL_ADCEx_Calibration_GetValue

HAL_ADC_GetCalibrationFactor

Parameters

  1. const ADC_HandleTypeDef *hadc

  2. uint32_t SingleDiff

  1. hal_adc_handle_t *hadc

  2. hal_adc_calib_t *p_calib

Return Value

Returns the selected ADC calibration value.

Returns HAL_OK if calibration factors are successfully retrieved, HAL_ERROR if an error occurs, or HAL_INVALID_PARAM if the parameter is invalid.

Related use case: Use case: conversion by polling


HAL ADCEx calibration set value

HAL1

HAL2

Function name

HAL_ADCEx_Calibration_SetValue

HAL_ADC_SetCalibrationFactor

Parameters

  1. ADC_HandleTypeDef *hadc

  2. uint32_t SingleDiff

  3. uint32_t CalibrationFactor

  1. hal_adc_handle_t *hadc

  2. const hal_adc_calib_t *p_calib

Return Value

Returns HAL_OK if the calibration factor is successfully set, HAL_ERROR if it fails.

Returns HAL_OK if the calibration factors are successfully set, HAL_ERROR if an error occurs, or HAL_INVALID_PARAM if the parameter is invalid.

Related use case: Use case: conversion by polling


HAL ADC start sampling

HAL1

HAL2

HAL_ADC_StartSampling

Removed; use LL_ADC_REG_StartSamplingPhase() instead.


HAL ADC stop sampling

HAL1

HAL2

HAL_ADC_StopSampling

Removed; use LL_ADC_REG_StopSamplingPhase() instead.


HAL ADCEx multimode get value data 32

HAL1

HAL2

HAL_ADCEx_MultiModeGetValue_Data32

Removed; use HAL_ADC_MM_REG_GetValue instead.


HAL ADCEx multimode start DMA data 32

HAL1

HAL2

HAL_ADCEx_MultiModeStart_DMA_Data32

Removed; use HAL_ADCEx_MultiModeStart_DMA() instead.